$(function() {
	/**
	 * 加载歌手
	 */
	addadminMainSinger();

	$("#chooseSingerHead").click(function() {
		$("#singerHead").toggle(300);
	});
	$("#singerHead").click(function() {
		$(this).toggle(300);
	});
});

/**
 * 加载歌手列表
 */
function addadminMainSinger() {
	$("table #tab").empty();
	$.post(path + "/main/addMainSinger.do",{},function(result) {
		if (result.success) {
			var list = result.data;
			var index = 1;
			$(list).each(function() {
				var div = '<tr><td><a href="'+path+'/admin/toFirstFindSongBySingerByPage.do?singer_id='
						+ this.singer_id+ '">'
						+ index
						+ '</a></td><td>'
						+ this.singer_name
						+ '</td><td>'
						+ this.nation
						+ '</td><td>'
						+ this.sex
						+ '</td><td><div class="visible-md visible-lg hidden-sm hidden-xs action-buttons"><a class="blue" href="'+path+'/admin/toadminAddSinger.do?user_id=${user.user_id}"><i class="icon-zoom-in bigger-130"></i> </a></div></td></tr>';
				$("table #tab").append(div);
				$("table #tab tr:last").data("singer", this);
				index++;
			});
		} else {
			alert(result.message);
		}
	});
}

function showfilter(dv) {
	$("#" + dv).fadeTo(100, 1);
}
function hidefilter(dv) {
	$("#" + dv).fadeTo(100, 0.5);
}

function save_img(index) {
	$("#singerHeadUrl").val(index + ".jpg");
}